<template>
  <div class="svg" style="width:100%;height:100%">
    <iframe class="svg" :src="svgUrl" border='none' frameborder=0 style="width:100%;height:100%" />
  </div>
</template>

<script lang="ts">
import { Component, Watch,Vue } from "vue-property-decorator";

@Component
export default class extends Vue {
  private svgUrl = "";
  mounted() {
    // console.log("this.$route.query:", this.$route.query);
  }
  @Watch("$route", { immediate: true })
  changeEvent() {
    this.setSvg();
  }
  setSvg() {
    if (this.$route.query.code) {
      let stationId = this.$route.query.code;
      let type = "铁芯接地电流";
      let form = {
        stationId: stationId,
        menuName: type,
      };
      (this as any).$services
        .queryDwUrl({ data: form, method: "get" })
        .then((result: any) => {
          // console.log("获取绘图图片地址:", result);
          let data = result.data;
          this.svgUrl = data;
        })
        .catch((err: object) => {
          console.log(err);
        });
    }
  }
}
</script>

<style lang="scss" scoped>
</style>

